home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Shareware
/
Utilitare
/
emu
/
Emu8086_Setup_307c.exe
/
{app}
/
Samples
/
int21.asm
< prev
next >
Wrap
Assembly Source File
|
2002-11-28
|
1KB
|
61 lines
; This sample gets a string
; from a user, and prints
; it out.
; INT 21h is used, thus
; DOS operating system is
; required.
#make_COM#
; COM file is loaded at 100h
; prefix:
ORG 100H
; set data segment:
MOV AX, CS
MOV DS, AX
MOV ES, AX
; input a string:
MOV DX, OFFSET s1
MOV AH, 0AH
INT 21h
; get one line down,
; by printing new
; line characters:
MOV DX, offset nl
MOV AH, 9
INT 21h
; set '$' to the end of
; inputed string:
MOV DI, offset s1
XOR BX, BX
; second byte of buffer holds
; the number of inputed
; characters:
MOV BL, [DI+1]
MOV BYTE PTR [DI+BX+2], '$'
; print the entered string:
MOV DX, offset s1
; first byte is buffer size,
; second actual characters
; entered, we skip
; these 2 bytes:
ADD DX, 2
MOV AH, 9
INT 21h
; exit to operating
; system:
MOV AH, 4Ch
INT 21h
; data:
s1 DB 30, 30 dup(' ')
nl DB 13, 10, '$'
END